package cn.silver.module.web.model;

import cn.silver.framework.core.constant.UserConstants;
import cn.silver.framework.core.validate.auth.PasswordGroup;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;


@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "LoginPasswordModel", title = "用户名密码登录对象")
public class LoginPasswordModel {

    @Schema(title = "登录验证码")
    private String code;

    @Schema(title = "验证码校验key")
    private String uuid;

    @Schema(title = "用户名")
    @NotBlank(message = "{user.username.not.blank}", groups = {PasswordGroup.class})
    @Length(min = UserConstants.USERNAME_MIN_LENGTH, max = UserConstants.USERNAME_MAX_LENGTH, message = "{user.username.length.valid}", groups = {PasswordGroup.class})
    private String username;

    @Schema(title = "登录密码")
    @NotBlank(message = "{user.password.not.blank}", groups = {PasswordGroup.class})
    @Length(min = UserConstants.PASSWORD_MIN_LENGTH, max = UserConstants.PASSWORD_MAX_LENGTH, message = "{user.password.length.valid}", groups = {PasswordGroup.class})
    private String password;

}
